angular.module("userapp")
.controller('editCtrl', function($scope, $http, $routeParams){

	$scope.profile = "";
	$http.post(base_url + 'index.php/user/getProfile').success(function(dat) {
		$scope.profile = dat;
		console.log(dat);
	});

	$scope.submitForm = function(profile) {
		//console.log(JSON.stringify(profile));
		p = profile;
		id = profile._id.$id;
		p._id = id;
		$http({
			url: base_url + 'index.php/user/getUpdateProfile',
			method: "POST",
			data: $.param({'profile': p}),
			headers: {'Content-Type': 'application/x-www-form-urlencoded'}
		}).success(function(data, status, header, config) {
			$scope.profile = data;
			console.log(data);
		});
	}
});